package com.jiecao.news.jiecaonews.activity;

import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.jiecao.news.jiecaonews.BaseActivity;
import com.jiecao.news.jiecaonews.R;
import com.jiecao.news.jiecaonews.util.MarketUtil;
import com.jiecao.news.jiecaonews.util.UtilsClass;
import com.jiecao.news.jiecaonews.util.constants.Constants;
import com.umeng.analytics.MobclickAgent;
import com.umeng.newxp.common.ExchangeConstants;
import com.umeng.newxp.controller.ExchangeDataService;
import com.umeng.newxp.view.ExchangeViewManager;
/**
 * 关于页
 * @author lidongwei
 *
 */
public class AboutActivity extends BaseActivity{
	private RelativeLayout newsInfoHeadBack;//		返回键
	private ImageButton welcome;//欢迎来吐槽
	private ImageButton intro;//为什么叫节操
	private ImageButton job;//招聘页面
	private ImageButton followus;//关注我们的微信
	private ImageButton ourhomesite;//我们的主页
	private ImageButton tougao;//投稿
	private ImageView moreApp;
	private TextView newsDateWeatherHeadText;
	private TextView newsLunarHeadText;
	Intent i;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_about);
		registerReceiver(finishbr, new IntentFilter(finish_br_name));
		

		newsInfoHeadBack = (RelativeLayout)findViewById(R.id.news_info_head_left_rl);
		welcome = (ImageButton)findViewById(R.id.welcome);
		intro = (ImageButton)findViewById(R.id.intro);
		job =(ImageButton)findViewById(R.id.job);
		followus = (ImageButton)findViewById(R.id.attention);
		ourhomesite = (ImageButton)findViewById(R.id.ourhomesite);
		tougao = (ImageButton)findViewById(R.id.tougao);
		moreApp = (ImageView)findViewById(R.id.back_banner_more_app);
		newsDateWeatherHeadText = (TextView)findViewById(R.id.news_date_weather_head_text);
		newsLunarHeadText  = (TextView)findViewById(R.id.news_lunar_head_text);
		newsDateWeatherHeadText.setText(UtilsClass.getNowDate());
		newsLunarHeadText.setText(UtilsClass.getLunar());
		i = new Intent();
		
		welcome.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				//打开邮箱
				Intent testintent=new Intent(Intent.ACTION_SEND);
				String[] tos={"feedback@jiecao.fm"};
				testintent.putExtra(Intent.EXTRA_EMAIL, tos);
				testintent.setType("message/rfc822");
				startActivity(Intent.createChooser(testintent, "发送"));
			}
		});
		intro.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				i.setClass(AboutActivity.this,NewsInfoActivity.class);
				i.putExtra("id", Constants.ABOUT_INFO);
				i.putExtra("type", 2);
				i.putExtra("title", getString(R.string.intro));
				startActivity(i);
			}
		});
		job.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				i.setClass(AboutActivity.this,NewsInfoActivity.class);
				i.putExtra("id", Constants.ABOUT_JOB);
				i.putExtra("type", 2);
				i.putExtra("title", getString(R.string.job));
				startActivity(i);
			}
		});
		followus.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View view) {
				i.setClass(AboutActivity.this,NewsInfoActivity.class);
				i.putExtra("id", Constants.ABOUT_FOLLOW);
				i.putExtra("type", 2);
				i.putExtra("title", getString(R.string.followus));
				startActivity(i);
			}
		});
		ourhomesite.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View view) {
				//进入某详情页
			}
		});
		moreApp.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				ExchangeDataService service = new ExchangeDataService();
				new ExchangeViewManager(AboutActivity.this, service).addView(
						ExchangeConstants.type_list_curtain, null);

			}
		});
		newsInfoHeadBack.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
		tougao.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				//打开邮箱
				Intent testintent=new Intent(Intent.ACTION_SEND);
				String[] tos={"tougao@jiecao.fm"};
				testintent.putExtra(Intent.EXTRA_EMAIL, tos);
				testintent.setType("message/rfc822");
				startActivity(Intent.createChooser(testintent, "发送"));
			}
		});
	}
	
	private void toNewsInfo(long id){
		Intent i = new Intent();
		i.setClass(this, NewsInfoActivity.class);
		i.putExtra("id",id);
		startActivity(i);
	}
	
	public void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
		}
	public void onPause() {
		super.onPause();
		MobclickAgent.onPause(this);
		}
}
